package cc.wx.fom.ui;

import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.GridPane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.stage.Stage;

/**
 * 创建于:2015年7月26日<br>
 * TODO
 * 
 * @author WangXue
 * @version 1.0.0
 */
public class FomApplication extends Application {
	private final double APP_WIDTH = 640;
	private final double APP_HEIGHT = 480;
	private final double TOP_HEIGHT = 20;
	private final double BOTTOM_HEIGHT = 10;
	private final double LEFT_RIGHT_WIDTH = 95;

	@Override
	public void start(Stage primaryStage) {
		BorderPane border = new BorderPane();
		border.setStyle("-fx-background-color: #336699;");

		AnchorPane topPane = new AnchorPane();
		topPane.setPrefSize(APP_WIDTH, TOP_HEIGHT);
		AnchorPane leftPane = new AnchorPane();
		leftPane.setPrefSize(LEFT_RIGHT_WIDTH, APP_HEIGHT - TOP_HEIGHT);
		AnchorPane rightPane = new AnchorPane();
		rightPane.setPrefSize(LEFT_RIGHT_WIDTH, APP_HEIGHT - TOP_HEIGHT);
		AnchorPane bottomPane = new AnchorPane();
		bottomPane.setPrefSize(APP_WIDTH, BOTTOM_HEIGHT);

		GridPane grid = new GridPane();
//		grid.setHgap(3);
//		grid.setVgap(3);
		grid.setPadding(new Insets(0, 10, 0, 10));
		grid.setStyle("-fx-background-color: #AAAAAA;");
		for (int i = 0; i < 9; i++) {
			for (int j = 0; j < 9; j++) {
				// Button btn = new Button();
				// btn.setText((j + 1) + "" + (i + 1));
				// grid.add(btn, i, j);
				AnchorPane anchor = new AnchorPane();
				anchor.setPrefSize(50, 50);
				anchor.setStyle("-fx-border-width:2px;-fx-border-color:#000000;");
//				Circle circle = new Circle(24, Color.GREEN);
//				circle.setOpacity(1);
//				anchor.getChildren().add(circle);
				grid.add(anchor, j, i);
			}
		}
		border.setTop(topPane);
		border.setCenter(grid);
		border.setRight(rightPane);
		border.setLeft(leftPane);
		border.setBottom(bottomPane);

		Scene scene = new Scene(border, APP_WIDTH, APP_HEIGHT);
		primaryStage.setTitle("五子连珠");
		primaryStage.setScene(scene);
		primaryStage.show();
	}

	public static void main(String[] args) {
		launch(args);
	}

}
